package com.jtmg.glorykingsnews.api;

import com.github.pagehelper.PageInfo;
import com.jtmg.glorykingsnews.domain.TbNotice;
import com.jtmg.glorykingsnews.service.TbNoticeService;
import com.jtmg.glorykingsnews.vo.NoticeVo.NotiveQueryVo;
import com.jtmg.glorykingsnews.vo.commom.MsgVo;
import com.jtmg.glorykingsnews.vo.user.UserQuery;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/notice/api")
public class NoticeApi {

    @Resource
    private TbNoticeService tbNoticeService;

    //根据标题或内容查询
    @RequestMapping("queryNotice")
    public PageInfo<TbNotice> queryNotice(@RequestBody NotiveQueryVo query) {
        return tbNoticeService.queryNotice(query);
    }

    //新增公告信息
    @RequestMapping("createNotice")
    private MsgVo createNotice(@RequestBody NotiveQueryVo vo){
        return tbNoticeService.createNotice(vo);
    }

    //删除公告信息
    @RequestMapping("deleteNotice")
    private MsgVo deleteNotice(@RequestBody int id){
        return tbNoticeService.deleteNotice(id);
    }
}
